<template>
  <div class="boxend">
    <!-- 头部 -->
    <div class="htear">
      <div class="left">
        <div
          @click="$router.go(-1)"
          class="return iconfont icon-arrowRight-copy-copy"
        ></div>
        <div class="name">完本</div>
      </div>
      <div class="age">
        <router-link tag="div" to="/schoolboy" class="com">男生</router-link>
        <router-link tag="div" to="/girlstudent">女生</router-link>
      </div>
      <div class="right">
        <router-link tag="div" to="/search" class="searchcon iconfont icon-31sousuo"></router-link>
        <div
          is-link
          @click="showPopup"
          class="classification iconfont icon-a-gengduofenlei"
        ></div>
      </div>
    </div>
    <!-- 弹出内容 -->
    <van-popup
      closeable
      v-model="show"
      position="top"
      :style="{ height: '45%' }"
    >
      <div class="boxpopup">
        <!-- 头部 -->
        <div class="htears">
          <div class="left">
            <div
              @click="$router.go(-1)"
              class="return iconfont icon-arrowRight-copy-copy"
            ></div>
            <div class="name">完本</div>
          </div>
        </div>
        <!-- 分类 -->
        <div class="guide-nav">
          <router-link tag="div" to="/schoolboy" class="box">
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-home-copy"></use>
            </svg>
            <div class="boxtext">首页</div>
          </router-link>
          <router-link tag="div" to="/classification" class="box">
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-fenlei"></use>
            </svg>
            <div>分类</div>
          </router-link>
          <router-link tag="div" to="/rankinglist" class="box">
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-daochu1024-02"></use>
            </svg>
            <div>排行榜</div>
          </router-link>
          <router-link tag="div" to="/cover" class="box">
            <svg class="icon" aria-hidden="true">
              <use
                xlink:href="#icon-a-travelhotelholidayvacationcdlistingboo"
              ></use>
            </svg>
            <div>免费</div>
          </router-link>
          <router-link tag="div" to="/end" class="box">
            <svg class="icon sw" aria-hidden="true">
              <use xlink:href="#icon-wanjietuijian"></use>
            </svg>
            <div>完本</div>
          </router-link>
          <router-link tag="div" to="/okami" class="box">
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-huangguan"></use>
            </svg>
            <div>大神</div>
          </router-link>
        </div>
        <!-- 我的书架 -->
        <router-link tag="div" to="/bookshelf" class="mybookshelf">我的书架</router-link>
      </div>
    </van-popup>
    <!-- 影视同期 -->
    <div class="hot">
      <div class="hotnav">
        <div class="div">影视同期</div>
        <span>火热影视原著</span>
      </div>
      <!-- 书籍 -->
      <div class="content">
        <!-- 轮播图 -->
        <div class="swiper-container-02">
          <div class="swiper-wrapper">
            <div
              @click="bookdeta(item.id)"
              class="swiper-slide item"
              v-for="(item, index) in imalists"
              :key="index"
            >
              <div class="img">
                <img :src="item.image" alt="" />
              </div>
              <p class="text">{{ item.title }}</p>
              <p class="name">{{ item.name }}</p>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 经典必读 -->
    <div class="hot">
      <!-- 头部 -->
      <div class="hotnav">
        <div class="div">经典必读</div>
        <router-link tag="div" :to="'/more?name=' + '经典必读'" class="more">更多<span class="iconfont icon-arrowRight-copy-copy-copy"></span></router-link>
      </div>
      <!-- 新书推荐 -->
      <div class="newarrivals">
        <div @click="bookdeta(item.id)" v-for="item in newbook" :key="item.id" class="newbook">
          <div class="left">
            <img :src="item.newbookimages" alt="" />
          </div>
          <div class="right">
            <div class="top">{{ item.bookname }}</div>
            <div class="centenr">
              {{ item.newbookintroduce }}
            </div>
            <div class="bottom">
              <div class="bookname">
                <span class="iconfont icon-31wode"></span>{{ item.author }}
              </div>
              <div class="label">
                <span>{{ item.type }}</span
                ><span>{{ item.serial }}</span
                ><span>{{ item.words }}万字</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 大神完本 -->
    <div class="hot">
      <!-- 头部 -->
      <div class="hotnav">
        <div class="div">大神完本</div>
        <router-link tag="div" :to="'/more?name=' + '大神完本'" class="more">更多<span class="iconfont icon-arrowRight-copy-copy-copy"></span></router-link>
      </div>
      <!-- 新书推荐 -->
      <div class="newarrivals">
        <div @click="bookdeta(item.id)" v-for="item in newbook" :key="item.id" class="newbook">
          <div class="left">
            <img :src="item.newbookimages" alt="" />
          </div>
          <div class="right">
            <div class="top">{{ item.bookname }}</div>
            <div class="centenr">
              {{ item.newbookintroduce }}
            </div>
            <div class="bottom">
              <div class="bookname">
                <span class="iconfont icon-31wode"></span>{{ item.author }}
              </div>
              <div class="label">
                <span>{{ item.type }}</span
                ><span>{{ item.serial }}</span
                ><span>{{ item.words }}万字</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 销售完本 -->
    <div class="hot">
      <!-- 头部 -->
      <div class="hotnav">
        <div class="div">销售完本</div>
        <span>一周热销完本书</span>
        <router-link tag="div" :to="'/more?name=' + '大神完本'" class="more">更多<span class="iconfont icon-arrowRight-copy-copy-copy"></span></router-link>
      </div>
      <!-- 新书推荐 -->
      <div class="newarrivals">
        <div @click="bookdeta(item.id)" v-for="item in newbook" :key="item.id" class="newbook">
          <div class="left">
            <img :src="item.newbookimages" alt="" />
          </div>
          <div class="right">
            <div class="top">{{ item.bookname }}</div>
            <div class="centenr">
              {{ item.newbookintroduce }}
            </div>
            <div class="bottom">
              <div class="bookname">
                <span class="iconfont icon-31wode"></span>{{ item.author }}
              </div>
              <div class="label">
                <span>{{ item.type }}</span
                ><span>{{ item.serial }}</span
                ><span>{{ item.words }}万字</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <footers></footers>
  </div>
</template>

<script>
import Swiper from "swiper";
import footers from '../components/base/footers.vue';
export default {
  components: { footers },
  data() {
    return {
      show: false, //弹出判断
      // 主编推荐列表数据
      imalists: [
        {
          id: 0,
          image: "https://bookcover.yuewen.com/qdbimg/349573/1030879001/150",
          title: "被揍就能变强",
          name: "新丰",
        },
        {
          id: 1,
          image: "https://bookcover.yuewen.com/qdbimg/349573/1030925549/150",
          title: "星界使徒",
          name: "齐佩甲",
        },
        {
          id: 2,
          image: "https://bookcover.yuewen.com/qdbimg/349573/1031830919/150",
          title: "联盟从4396开始",
          name: "超气人作者",
        },
        {
          id: 3,
          image: "https://bookcover.yuewen.com/qdbimg/349573/1031299884/150",
          title: "看个直播，我竟被当成了仙师？",
          name: "我真不想出名",
        },
        {
          id: 4,
          image: "https://bookcover.yuewen.com/qdbimg/349573/1027549281/150",
          title: "西游，我体内有九只金乌",
          name: "可怜的懒虫",
        },
        {
          id: 5,
          image: "https://bookcover.yuewen.com/qdbimg/349573/1029100123/150",
          title: "小兵活下去",
          name: "蓝色星轮",
        },
        {
          id: 6,
          image: "https://bookcover.yuewen.com/qdbimg/349573/1027551057/150",
          title: "重生之似水流年",
          name: "苍山月",
        },
      ],
       // 推荐新书列表
      newbook: [
        {
          id: 13,
          bookname: "明克街13号",
          newbookimages:
            "https://bookcover.yuewen.com/qdbimg/349573/1030870265/150",
          newbookintroduce:
            "我喜欢坐在夜晚空无一人的大街上，听着“他们”的窃窃私语，享受着“他们”的喧嚣。",
          author: "纯洁滴小龙",
          type: "都市",
          serial: "连载中",
          words: 65.04,
        },
        {
          id: 3,
          bookname: "看个直播，我竟被当成了仙师？",
          newbookimages:
            "https://bookcover.yuewen.com/qdbimg/349573/1031299884/150",
          newbookintroduce:
            "苏凡是一个探险发烧友，意外重生到平行世界，这个世界诡异知识匮乏，甚至没有相关传说。本来苏凡也没太在意，以为这是一个正常的科技世界，直到闲着无聊看明星探险队的直播……镜头前一个皮肤白暂十分清纯甜美的姑娘对着大家打招呼。“冰夏直播间的各位小伙伴们大家好啊，我是叶语冰，我们的荒村探险之旅马上就要开始了，大家期待吗？”叶语冰身披一件红色呢子衣，清纯脸庞带着无暇的笑容总是那么令人陶醉。【期待！】【期待！期待！！】……网友的期待打满了整个公屏。【此地背阴，位于山坳中，三面环山，乃邪汇聚之地，还是早点回去吧。】寝室内，苏凡皱眉发了一句。顿时引起了直播间网友的一片讨伐！直到……然后……最后……，苏凡：我随便说几句，就被当成了仙师？——————普通读者群：群号:513540505（欢迎所有读者）VIP读者群：群号:940069612（需要2000以上粉丝值）",
          author: "我真不想出名",
          type: "都市",
          serial: "连载中",
          words: 31.92,
        },
        {
          id: 51,
          bookname: "某美漫的超级玩家",
          newbookimages:
            "https://bookcover.yuewen.com/qdbimg/349573/1031112653/150",
          newbookintroduce:
            "美漫世界，重新启航！这一次，是有关于洛克的故事！姓名洛克。职业玩家！唯一玩家！:513540505（欢迎所有读者）",
          author: "米一克",
          type: "科幻",
          serial: "连载中",
          words: 104.69,
        },
      ],
    };
  },
  methods: {
    //头部弹出
    showPopup() {
      this.show = true;
    },
    bookdeta(id) {
      this.$router.push({
        path: "/bookdetails",
        query: {
          id: id
        },
      });
    },
  },
   mounted() {
    new Swiper(".swiper-container-02", {
      pagination: ".swiper-pagination-02",
      slidesPerView: 4.5,
      paginationClickable: true,
      observer: true,
      observeParents: true,
      spaceBetween: 30,
    });
  },
};
</script>

<style lang="less">
.boxend {
  // 关闭按钮
  .van-popup__close-icon--top-right {
    top: 13px;
  }
  .boxpopup {
    .htears {
      width: 100%;
      display: flex;
      height: 22px;
      padding: 11px 0px 10px 0px;
      justify-content: space-between;
      align-items: center;
      .age {
        display: flex;
        height: 24px;
        border: 1px solid #ed424b;
        border-radius: 3px;
        div {
          font-size: 15px;
          line-height: 24px;
          color: #ed424b;
          padding: 0px 10px;
        }
        .com {
          background: #ed424b;
          color: white;
        }
      }
      .left,
      .right {
        display: flex;
        div {
          padding: 0px 10px;
          text-align: center;
          font-size: 18px;
          color: #3c3b3b;
        }
        .name {
          font-size: 14px;
          color: #424141;
        }
        .return {
          color: black;
        }
      }
    }
    .guide-nav {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      padding: 0px 16px;
      .box {
        width: 58px;
        height: 58px;
        line-height: 58px;
        text-align: center;
        margin: 12px 24px;
        div {
          position: relative;
          top: -33px;
          font-size: 14px;
        }
      }
    }
    .mybookshelf {
      margin: 20px 50px;
      text-align: center;
      padding: 8px 0px;
      font-size: 14px;
      color: white;
      font-weight: 500;
      background-color: #ed424b;
      border-radius: 20px;
    }
    .sw {
      font-size: 40px;
    }
  }
  .htear {
    width: 100%;
    display: flex;
    height: 22px;
    padding: 11px 0px 10px 0px;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e8e7e7;
    background-color: white;
    .left,
    .right {
      display: flex;
      div {
        padding: 0px 10px;
        text-align: center;
        font-size: 18px;
        color: #3c3b3b;
      }
      .name {
        font-size: 14px;
        color: #424141;
      }
      .return {
        color: black;
      }
    }
    .age {
      display: flex;
      height: 24px;
      border: 1px solid #ed424b;
      border-radius: 3px;
      div {
        font-size: 15px;
        line-height: 24px;
        color: #ed424b;
        padding: 0px 10px;
      }
      .com {
        background: #ed424b;
        color: white;
      }
    }
  }
  .hot {
    width: calc(100% - 30px);
    padding: 0px 15px;
    background: white;
    margin-bottom: 12px;
    .hotnav {
      padding: 15px 0px;
      display: flex;
      align-items: center;
      padding-bottom: 20px;
      position: relative;
      .div {
        font-size: 16px;
        font-weight: 600;
        padding: 0px 9px;
        border-left: 2px solid red;
        color: #33373D;
      }
      span{
          color:#969BA3;
          font-size: 13px;
          margin-left: 8px;
      }
      .more {
        font-size: 14px;
        color: #a4a8c3;
        border: 0px;
        position: absolute;
        top: 15px;
        right: 0px;
      }
    }

    .swiper-container-02 {
      max-width: 345px;
      overflow: hidden;
      .swiper-wrapper {
        display: flex;
      }
    }
    .content {
      width: 100%;
      padding-bottom: 15px;
      .item {
        width: 66px;
        .img {
          width: 66px;
          height: 88px;

          img {
            width: 100%;
            height: 100%;
          }
        }
        .text {
          width: 66px;
          overflow: hidden;
          font-size: 13px;
          max-height: 36px;
          color: #3a3939;
          margin: 5px 0px;
        }
        .name {
          font-size: 12px;
          color: #969ba3;
          height: 12px;
          width: 66px;
          line-height: 12px;
          overflow: hidden;
        }
      }
    }
    .newarrivals {
      display: flex;
      flex-direction: column;
      .newbook {
        padding-bottom: 10px;
        margin-bottom: 10px;
        width: 100%;
        display: flex;
        border-bottom: 1px solid #ebedf1;
        .left {
          width: 66px;
          height: 88px;
          margin-right: 8px;
          img {
            width: 100%;
            height: 100%;
          }
        }
        .right {
          width: 269px;
          .top {
            font-size: 16px;
            font-weight: 900;
            color: #33373d;
            line-height: 1.4;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
          }
          .centenr {
            color: #969ba3;
            font-size: 14px;
            line-height: 1.1875rem;
            display: -webkit-box;
            height: 2.25rem;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            overflow: hidden;
            margin: 6px 0;
          }
          .bottom {
            display: flex;
            color: #969ba3;
            font-size: 12px;
            justify-content: space-between;
            .bookname {
              font-size: 13px;
              .icon-31wode {
                margin-right: 3px;
                font-size: 13px;
              }
            }
            .label {
              display: flex;
              span {
                margin-left: 2px;
                font-size: 12px;
                display: block;
                padding: 1px 2px;
                transform: scale(0.8);
              }
              span:nth-child(1) {
                border: 1px solid #969ba3;
                color: #969ba3;
              }
              span:nth-child(2) {
                border: 1px solid #ed424b;
                color: #ed424b;
              }
              span:nth-child(3) {
                border: 1px solid #008dff;
                color: #008dff;
              }
            }
          }
        }
      }
      .newbook:nth-child(3) {
        border-block: 0px;
      }
      
    }
  }
}
</style>